Dynamic handling of object versions to support space and time dimensional program execution

ABSTRACT

One embodiment of the present invention provides a system that supports space and time dimensional program execution by facilitating accesses to different versions of a memory element. The system supports a head thread that executes program instructions and a speculative thread that executes program instructions in advance of the head thread. The head thread accesses a primary version of the memory element, and the speculative thread accesses a space-time dimensioned version of the memory element. During a reference to the memory element by the head thread, the system accesses the primary version of the memory element. During a reference to the memory element by the speculative thread, the speculative thread accesses a pointer associated with the primary version of the memory element, and accesses a version of the memory element through the pointer. Note that the pointer points to the space-time dimensioned version of the memory element if the space-time dimensioned version of the memory element exists. In one embodiment of the present invention, the pointer points to the primary version of the memory element if the space-time dimensioned version of the memory element does not exist.

RELATED APPLICATION

This application is a continuation-in-part of a pending U.S. patentapplication, entitled “Supporting Space-Time Dimensional ProgramExecution by Selectively Versioning Memory Updates,” by inventorsShailender Chaudhry and Marc Tremblay, having Ser. No. 09/313,229 and afiling date of May 17, 1999, now U.S. Pat. No. 6,353,881. Thisapplication hereby claims priority under 35 U.S.C. § 120 to theabove-listed patent application.

BACKGROUND

1. Field of the Invention

The present invention relates to techniques for improving computersystem performance. More specifically, the present invention relates toa method and apparatus that provides dynamic handling of object versionsto support space and time dimensional execution of a computer program.

2. Related Art

As increasing semiconductor integration densities allow more transistorsto be integrated onto a microprocessor chip, computer designers areinvestigating different methods of using these transistors to increasecomputer system performance. Some recent computer architectures exploit“instruction level parallelism,” in which a single central processingunit (CPU) issues multiple instructions in a single cycle. Given propercompiler support, instruction level parallelism has proven effective atincreasing computational performance across a wide range ofcomputational tasks. However, inter-instruction dependencies generallylimit the performance gains realized from using instruction levelparallelism to a factor of two or three.

Another method for increasing computational speed is “speculativeexecution” in which a processor executes multiple branch pathssimultaneously, or predicts a branch, so that the processor can continueexecuting without waiting for the result of the branch operation. Byreducing dependencies on branch conditions, speculative execution canincrease the total number of instructions issued.

Unfortunately, conventional speculative execution typically provides alimited performance improvement because only a small number ofinstructions can be speculatively executed. One reason for thislimitation is that conventional speculative execution is typicallyperformed at the basic block level, and basic blocks tend to includeonly a small number of instructions. Another reason is that conventionalhardware structures used to perform speculative execution can onlyaccommodate a small number of speculative instructions.

What is needed is a method and apparatus that facilitates speculativeexecution of program instructions at a higher level of granularity sothat many more instructions can be speculatively executed.

One challenge in designing a system that supports speculative executionis to efficiently keep track the different versions of memory elementsthat are created during speculative execution. If a speculativelyexecuted instruction performs a write operation to a memory element, thewrite operation creates a speculative version of the memory element thatremains separate from a non-speculative version of the memory elementuntil the speculative version is merged into the non-speculative versionat some time in the future. This merging operation can only take placewhen it is certain that the speculatively executed instruction completedsuccessfully.

What is needed is a method and an apparatus that efficiently keeps trackdifferent versions of memory elements that are created duringspeculative execution.

SUMMARY

One embodiment of the present invention provides a system that supportsspace and time dimensional program execution by facilitating accesses todifferent versions of a memory element. The system supports a headthread that executes program instructions and a speculative thread thatexecutes program instructions in advance of the head thread. The headthread accesses a primary version of the memory element, and thespeculative thread accesses a space-time dimensioned version of thememory element. During a reference to the memory element by the headthread, the system accesses the primary version of the memory element.During a reference to the memory element by the speculative thread, thespeculative thread accesses a pointer associated with the primaryversion of the memory element, and accesses a version of the memoryelement through the pointer. Note that the pointer points to thespace-time dimensioned version of the memory element if the space-timedimensioned version of the memory element exists.

In one embodiment of the present invention, the pointer points to theprimary version of the memory element if the space-time dimensionedversion of the memory element does not exist.

In one embodiment of the present invention, the pointer points to a datastructure that points to the space-time dimensioned version of thememory element if the space-time dimensioned version of the memoryelement exists.

In one embodiment of the present invention, the memory element is partof an object defined within an object-oriented programming system.

In one embodiment of the present invention, if the reference is a writeoperation by the speculative thread and the space-time dimensionedversion of the memory element does not exist, the system creates thespace-time dimensioned version of the memory element and sets thepointer to point to the space-time dimensioned version of the memoryelement.

In one embodiment of the present invention, if the reference is a readoperation by the speculative thread, the read operation is directed tothe space-time dimensioned version of the memory element if it exists,and otherwise is directed to the primary version of the memory element.

In one embodiment of the present invention, during a reference to thememory element by the speculative thread, the method further comprisesupdating status information associated with the memory element toindicate that the reference to the memory element by the speculativethread took place.

Another embodiment of the present invention provides a system thatproduces code to access different versions of a memory element in orderto support space and time dimensional execution. The system operates byreceiving a byte code version of a program, and translating the bytecode version of the program into a head thread version of the programthat accesses the primary version of the memory element. The system alsotranslates the byte code version of the program into a speculativethread version of the program that accesses a version of the memoryelement through a pointer associated with the primary version of thememory element. Note that this pointer points to the space-timedimensioned version of the memory element if the space-time dimensionedversion of the memory element exists, and otherwise points to theprimary version of the memory element.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 illustrates a computer system including two central processingunits sharing a common data cache in accordance with an embodiment ofthe present invention.

FIG. 2A illustrates sequential execution of methods by a single thread.

FIG. 2B illustrates space and time dimensional execution of a method inaccordance with an embodiment of the present invention.

FIG. 3 illustrates the state of the system stack during space and timedimensional execution of a method in accordance with an embodiment ofthe present invention.

FIG. 4 illustrates how memory is partitioned between stack and heap inaccordance with an embodiment of the present invention.

FIG. 5 illustrates the structure of a primary version and a space-timedimensioned version of an object in accordance with an embodiment of thepresent invention.

FIG. 6 illustrates the structure of a status word for an object inaccordance with an embodiment of the present invention.

FIG. 7 is a flow chart illustrating operations involved in performing awrite to a memory element by a head thread in accordance with anembodiment of the present invention.

FIG. 8 is a flow chart illustrating operations involved in performing aread to a memory element by a speculative thread in accordance with anembodiment of the present invention.

FIG. 9 is a flow chart illustrating operations involved in performing awrite to a memory element by a speculative thread in accordance with anembodiment of the present invention.

FIG. 10 is a flow chart illustrating operations involved in performing ajoin between a head thread and a speculative thread in accordance withan embodiment of the present invention.

FIG. 11 is a flow chart illustrating operations involved in performing ajoin between a head thread and a speculative thread in accordance withanother embodiment of the present invention.

FIG. 12 illustrates how a program in byte code form is translated into ahead thread version and a speculative thread version in accordance withan embodiment of the present invention.

FIG. 13A is a flow chart illustrating how the head thread version of aprogram accesses a memory element in accordance with an embodiment ofthe present invention.

FIG. 13B is a flow chart illustrating how the speculative thread versionof the program accesses the memory element in accordance with anembodiment of the present invention.

FIG. 14 is a flow chart illustrating how the head thread version of theprogram and the speculative thread version of the program are created inaccordance with an embodiment of the present invention.

DETAILED DESCRIPTION

The following description is presented to enable any person skilled inthe art to make and use the invention, and is provided in the context ofa particular application and its requirements. Various modifications tothe disclosed embodiments will be readily apparent to those skilled inthe art, and the general principles defined herein may be applied toother embodiments and applications without departing from the spirit andscope of the present invention. Thus, the present invention is notintended to be limited to the embodiments shown, but is to be accordedthe widest scope consistent with the principles and features disclosedherein.

The data structures and code described in this detailed description aretypically stored on a computer readable storage medium, which may be anydevice or medium that can store code and/or data for use by a computersystem. This includes, but is not limited to, magnetic and opticalstorage devices such as disk drives, magnetic tape, CDs (compact discs)and DVDs (digital video discs), and computer instruction signalsembodied in a carrier wave. For example, the carrier wave may carryinformation across a communications network, such as the Internet.

Computer System

FIG. 1 illustrates a computer system including two central processingunits (CPUs) 102 and 104 sharing a common data cache 106 in accordancewith an embodiment of the present invention. In this embodiment, CPUs102 and 104 and data cache 106 reside on silicon die 100. Note that CPUs102 and 104 may generally be any type of computational devices thatallow multiple threads to execute concurrently. In the embodimentillustrated in FIG. 1, CPUs 102 and 104 are very long instruction word(VLIW) CPUs, which support concurrent execution of multiple instructionsexecuting on multiple functional units. VLIW CPUs 102 and 104 includeinstruction caches 112 and 120, respectively, containing instructions tobe executed by VLIW CPUs 102 and 104.

VLIW CPUs 102 and 104 additionally include load buffers 114 and 122 aswell as store buffers 116 and 124 for buffering communications with datacache 106. More specifically, VLIW CPU 102 includes load buffer 114 forbuffering loads received from data cache 106, and store buffer 116 forbuffering stores to data cache 106. Similarly, VLIW CPU 104 includesload buffer 122 for buffering loads received from data cache 106, andstore buffer 124 for buffering stores to data cache 106.

VLIW CPUs 102 and 104 are additionally coupled together by directcommunication link 128, which facilitates rapid communication betweenVLIW CPUs 102 and 104. Note that direct communication link 128 allowsVLIW CPU 102 to write into communication buffer 126 within VLIW CPU 104.It also allows VLIW CPU 104 to write into communication buffer 118within VLIW CPU 102.

In the embodiment illustrated in FIG. 1, Data cache 106 is fullydual-ported allowing concurrent read and/or write accesses from VLIWCPUs 102 and 104. This dual porting eliminates cache coherence delaysassociated with conventional shared memory architectures that rely oncoherent caches.

In one embodiment of the present invention, data cache 106 is a 16K byte4-way set-associative data cache with 32 byte cache lines.

Data cache 106, instruction caches 112 and instruction cache 120 arecoupled through switch 110 to memory controller 111. Memory controller111 is coupled to dynamic random access memory (DRAM) 108, which islocated off chip. Switch 110 may include any type of circuitry forswitching signal lines. In one embodiment of the present invention,switch 110 is a cross bar switch.

The present invention generally applies to any computer system thatsupports concurrent execution by multiple threads and is not limited tothe illustrated computing system. However, note that data cache 106supports fast accesses to shared data items. These fast accessesfacilitate efficient sharing of status information between VLIW CPUs 102and 104 to keep track of accesses to versions of memory objects.

Space-Time Dimensional Execution of Methods

FIG. 2A illustrates sequential execution of methods in a conventionalcomputer system by a single head thread 202. In executing a program,head thread 202 executes a number of methods in sequence, includingmethod A 204, method B 206 and method C 208.

In contrast, FIG. 2B illustrates space and time dimensional execution ofa method in accordance with an embodiment of the present invention. InFIG. 2B, head thread 202 first executes method A 204 and then executesmethod B 206. (For this example, assume that method B 206 returns a voidor some other value that is not used by method C 208. Alternatively, ifmethod C 208 uses a value returned by method B206, assume that method C208 uses a predicted return value from method B 206.)

As head thread 202 executes method B 206, speculative thread 203executes method C 208 in a separate space-time dimension of the heap. Ifhead thread 202 successfully executes method B 206, speculative thread203 is joined with head thread 202. This join operation involves causingstate associated with the speculative thread 203 to be merged with stateassociated with the head thread 202 and the collapsing of the space-timedimensions of the heap.

If speculative thread 203 for some reason encounters problems inexecuting method C 208, speculative thread 203 performs a rollbackoperation. This rollback operation allows speculative thread 203 toreattempt to execute method C 208. Alternatively, head thread 202 canexecute method C 208 non-speculatively and speculative thread 203 canexecute a subsequent method.

There are a number of reasons why speculative thread 203 may encounterproblems in executing method C 208. One problem occurs when head thread202 executing method B 206 writes a value to a memory element (object)after speculative thread 203 has read the same memory element. The samememory element can be read when the two space-time dimensions of theheap are collapsed at this memory element at the time of the read byspeculative thread 203. In this case, speculative thread 203 should haveread the value written by head thread 202, but instead has read aprevious value. In this case, the system causes speculative thread 203to roll back so that speculative thread 203 can read the value writtenby head thread 202.

Note that the term “memory element” generally refers to any unit ofmemory that can be accessed by a computer program. For example, the term“memory element” may refer to a bit, a byte or a word memory, as well asa data structure or an object defined within an object-orientedprogramming system.

FIG. 3 illustrates the state of the system stack during space and timedimensional execution of a method in accordance with an embodiment ofthe present invention. Note that since programming languages such as theJava programming language do not allow a method to modify the stackframe of another method, the system stack will generally be the samebefore method B 206 is executed as it is before method C 208 isexecuted. (This is not quite true if method B 206 returns a parameterthrough the system stack. However, return parameters are can beexplicitly dealt with as is described below.) Referring the FIG. 3,stack 300 contains method A frame 302 while method A 204 is executing.When method A 204 returns, method B 206 commences and method A frame 302is replaced by method B frame 304. Finally, when method B 206 returns,method C 208 commences and method B frame 304 is replaced by method Cframe 306. Note that since stack 300 is the same immediately beforemethod B 206 executed as it is immediately before method C 208 isexecuted, it is possible to execute method C 208 using a copy of stack300 without first executing method B 206.

In order to undo the results of speculatively executed operations,updates to memory need to be versioned. The overhead involved inversioning all updates to memory can be prohibitively expensive due toincreased memory requirements, decreased cache performance andadditional hardware required to perform the versioning.

Fortunately, not all updates to memory need to be versioned. Forexample, updates to local variables—such as a loop counter—on a systemstack are typically only relevant to the thread that is updating thelocal variables. Hence, even for speculative threads versioning updatesto these local variables is not necessary.

When executing programs written in conventional programming languages,such as C, it is typically not possible to determine which updates arerelated to the heap, and which updates are related to the system stack.These programs are typically compiled from a high-level languagerepresentation into executable code for a specific machine architecture.This compilation process typically removes distinctions between updatesto heap and system stack.

The same is not true for new platform-independent computer languages,such as the JAVA™ programming language distributed by SUN Microsystems,Inc. of Palo Alto, Calif. (Sun, the Sun logo, Sun Microsystems, and Javaare trademarks or registered trademarks of Sun Microsystems, Inc. in theUnited States and other countries.) A program written in the Javaprogramming language is typically compiled into a class file containingJava byte codes. This class file can be transmitted over a computernetwork to a distant computer system to be executed on the distantcomputer system. Java byte codes are said to be “platform-independent,”because they can be executed across a wide range of computing platforms,so long as the computing platforms provide a Java virtual machine.

A Java byte code can be executed on a specific computing platform byusing an interpreter or a just in time (JIT) compiler to translate theJava byte code into machine code for the specific computing platform.Alternatively, a Java byte code can be executed directly on a Java bytecode engine running on the specific computing platform.

Fortunately, a Java byte code contains more syntactic information thanconventional machine code. In particular, the Java byte codesdifferentiate between accesses to local variables in the system stackand accesses to the system heap. Furthermore, programs written in theJava programming language do not allow conversion between primitive andreference types. Such conversion can make it hard to differentiateaccesses to the system stack from accesses to the system heap at compiletime.

Data Structures to Support Space-Time Dimensional Execution

FIG. 4 illustrates how memory is partitioned between stack and heap inaccordance with an embodiment of the present invention. In FIG. 4,memory 400 is divided into a number of regions including heap 402,stacks for threads 404 and speculative heap 406. Heap 402 comprises aregion of memory from which objects are allocated. Heap 402 is furtherdivided into younger generation region 408 and older generation region410 for garbage collection purposes. For performance reasons, garbagecollectors typically treat younger generation objects differently fromolder generation objects. Stack for threads 404 comprises a region ofmemory from which stacks for various threads are allocated. Speculativeheap 406 contains the space-time dimensioned values of all memoryelements where the two space-time dimensions of the heap are notcollapsed. This includes space-time dimensional versions of objects, forexample, version 510 of object 500 as shown in FIG. 5, and objectscreated by speculative thread 203. For garbage collection purposes,these objects created by speculative thread 203 can be treated asbelonging to a generation that is younger than objects within youngergeneration region 408.

FIG. 5 illustrates the structure of a primary version of object 500 anda space-time dimensioned version of object 510 in accordance with anembodiment of the present invention.

Primary version of object 500 is referenced by object reference pointer501. Like any object defined within an object-oriented programmingsystem, primary version of object 500 includes data region 508,whichincludes one or more fields containing data associated with primaryversion of object 500. Primary version of object 500 also includesmethod vector table pointer 506. Method vector table pointer 506 pointsto a table containing vectors that point to the methods that can beinvoked on primary version of object 500.

Primary version of object 500 also includes space-time dimensionedversion pointer 502, which points to space-time dimensioned version ofobject 510, if the two space-time dimensions are not collapsed at thisobject. Note that in the illustrated embodiment of the presentinvention, space-time dimensioned version 510 is always referencedindirectly through space-time dimensioned version pointer 502. Primaryversion of object 500 additionally includes status word 504, whichcontains status information specifying which fields from data region 508have been written to or read by speculative thread 203. Space-timedimensioned version of object 510 includes only data region 518.

FIG. 6 illustrates the structure of status word 504 in accordance withan embodiment of the present invention. In this embodiment, status word504 includes checkpoint number 602 and speculative bits 603. Speculativebits 603 includes read bits 604 and write bits 606. When status word 504needs to be updated due to a read or a write by speculative thread 203,checkpoint number 602 is updated with the current time of the system.The current time in the time dimension of the system is advanceddiscretely at a join or a rollback. This allows checkpoint number 602 tobe used as a qualifier for speculative bits 603. If checkpoint number602 is less than the current time, speculative bits 603 can beinterpreted as reset.

Read bits 604 keep track of which fields within data region 508 havebeen read since the last join or rollback. Correspondingly, write bits606 keep track of which fields within data region 508 have been writtensince the last join or rollback. In one embodiment of the presentinvention, read bits 604 includes one bit for each field within dataregion 508. In another embodiment, read bits includes fewer bits thanthe number of fields within data region 508. In this embodiment, eachbit within read bits 604 corresponds to more than one field in dataregion 508. For example, if there are eight read bits, each bitcorresponds to every eighth field. Write bits 606 similarly cancorrespond to one or multiple fields within data region 508.

Space-Time Dimensional Update Process

Space-time dimensioning occurs during selected memory updates. For localvariable and operand accesses to the system stack, no space-timedimensioned versions exist and nothing special happens. During readoperations by head thread 202 to objects in the heap 402, again nothingspecial happens.

Special operations are involved in write operations by head thread 202as well as read and write operations by speculative thread 203. Thesespecial operations are described in more detail with reference toFIGs.7, 8 and 9 below.

FIG. 7 is a flow chart illustrating operations involved in a writeoperation to an object by a head thread 202 in accordance with anembodiment of the present invention. The system writes to the primaryversion of object 500 and the space-time dimensioned version of object510 if the two space-time dimensions are not collapsed at this point(step 702). Next, the system checks status word 504 within primaryversion of object 500 to determine whether a rollback is required (step704). A rollback is required if speculative thread 203 previously readthe data element. The same memory element can be read when the twospace-time dimensions of the heap are collapsed at this memory elementat the time of the read by speculative thread 203. A rollback is alsorequired if speculative thread 203 previously wrote to the object andthus ensured that the two dimensions of the object are not collapsed atthis element, and if the current write operation updates both primaryversion of object 500 and space-time dimensioned version of object 510.

If a rollback is required, the system causes speculative thread 203 toperform a rollback operation (step 706). This rollback operation allowsspeculative thread 203 to read from (or write to) the object after headthread 202 writes to the object.

Note that in the embodiment of the present invention illustrated in FIG.7 the system performs writes to both primary version 500 and space-timedimensioned version 510. In an alternative embodiment, the system firstchecks to determine if speculative thread 203 previously wrote tospace-time dimensioned version 510. If not, the system writes to bothprimary version 500 and space-time dimensioned version 510. If so, thesystem only writes to primary version 500.

FIG. 8 is a flow chart illustrating operations involved in a readoperation to an object by speculative thread 203 in accordance with anembodiment of the present invention. During this read operation, thesystem sets a status bit in status word 504 within primary version ofobject 500 to indicate that primary version 500 has been read (step802). Speculative thread 203 then reads space-time dimensioned version510, if it exists. Otherwise, speculative thread 203 reads primaryversion 500.

FIG. 9 is a flow chart illustrating operations involved in a writeoperation to a memory element by speculative thread 203 in accordancewith an embodiment of the present invention. If a space-time dimensionedversion 510 does not exist, the system creates a space-time dimensionedversion 510 in speculative heap 406 (step 902). The system also updatesstatus word 504 to indicate that speculative thread 203 has written tothe object if such updating is necessary (step 903). The system nextwrites to space-time dimensioned version 510 (step 904). Such updatingis necessary if head thread 202 must subsequently choose between writingto both primary version 500 and space-time dimensioned version 510, orwriting only to primary version 500 as is described above with referenceto FIG. 7.

FIG. 10 is a flow chart illustrating operations involved in a joinoperation between head thread 202 and a speculative thread 203 inaccordance with an embodiment of the present invention. A join operationoccurs for example when head thread 202 reaches a point in the programwhere speculative thread 203 began executing. The join operation causesstate associated with the speculative thread 203 to be merged with stateassociated with the head thread 202. This involves copying and/ormerging the stack of speculative thread 203 into the stack of headthread 202 (step 1002). It also involves merging space-time dimensionand primary versions of objects (step 1004) as well as possibly garbagecollecting speculative heap 406 (step 1006). In one embodiment of thepresent invention, one of threads 202 or 203 performs steps 1002 and1006, while the other thread performs step 1004.

FIG. 11 is a flow chart illustrating operations involved in a joinoperation between head thread 202 and a speculative thread 203 inaccordance with another embodiment of the present invention. In thisembodiment, speculative thread 203 carries on as a pseudo-head thread.As a pseudo-head thread, speculative thread 203 uses indirection toreference space-time dimensioned versions of objects, but does not markobjects or create versions. While speculative thread 203 is acting as apseudo-head thread, head thread 202 updates primary versions of objects.

Head Thread Version and Speculative Thread Version of a Program

FIG. 12 illustrates how a program in byte code form is translated into ahead thread version and a speculative thread version in accordance withan embodiment of the present invention. The system starts with a programin byte code form. This program includes a number of memory referencesincluding a “getfield” command to read a memory element, and a“putfield” command to write a memory element.

Note that in one embodiment of the present invention, the program inbyte code form includes Java byte codes that run on a Java virtualmachine. Java byte codes are often interpreted or just-in-time (JIT)compiled by a Java virtual machine immediately prior to execution. Insome instances, frequently used library methods are pre-compiled fromJava byte codes into machine code. The discussion below applies to thispre-compilation process and the just-in-time compilation process. Alsonote that in another embodiment of the present invention, the program inbyte code form is a source code version of a program.

Note that the program in byte code form is precompiled into a program inmachine code form 1204 for head thread 202 and a program in machine codeform 1206 for speculative thread 203.

In producing the machine code for head thread 202, the getfield commandis compiled into machine code instructions. These machine codeinstructions load a reference into a register (if the reference is notalready in the register). In one embodiment of the present invention,the reference is a pointer to the start of a block of fields for anobject defined within an object-oriented programming system. Once thisreference is loaded, the system uses the reference and a field offset toload the field.

In producing the machine code for head thread 202, the putfield commandis precompiled into a number of machine code instructions that store avalue to a field. During the putfield command, the reference is firstloaded into a register if it is not already there. Next, the referenceand a field offset are used to store a value to the field. Also, themarking bits are checked for a possible rollback. If a marking bit isset, a rollback is issued.

In producing the machine code version of the program for speculativethread 203, the getfield command is compiled into a number of machinecode instructions. These machine code instructions perform an“indirection load” through a pointer (such as space-time dimensionedversion pointer 502) to retrieve a reference to a version of the memoryelement into a register. Note that the pointer points to the space-timedimensioned version of the memory element 510 if the space-timedimensioned version of the memory element 510 exists. Otherwise, thepointer points to the primary version of the memory element 500. Afterthe indirection load is complete, the machine code sets marking bitsassociated with the memory element to indicate that the memory elementhas been read by speculative thread 203. Finally, the machine code loadsa value from the specified field using a field offset.

In producing the machine code version of the program for speculativethread 203, the putfield command is compiled into machine code. Thismachine code first checks to see if the a space time dimensioned versionof the memory element 510 exists. If the not, the machine code creates aversion. The machine code also performs an “indirection load” through apointer (such as space-time dimensioned version pointer 502 from FIG. 5)to retrieve a reference to a version of the memory element into aregister. After the indirection load is complete, the machine code setsmarking bits associated with the memory element to indicate that thememory element has been written to by speculative thread 203. Finally,the machine code stores a value to the specified field using a fieldoffset.

Note that the above described machine code instructions to perform thegetfield and putfield commands can be precompiled into templates thatcan be substituted for the getfield and putfield commands during thecompilation process in order to speed up the compilation process.

FIG. 13A is a flow chart illustrating how the head thread version of aprogram accesses a memory element in accordance with an embodiment ofthe present invention. The head thread version of the program simplyaccesses the primary version of the memory element (step 1302). Asmentioned previously, in some embodiments of the present invention, headthread 202 may perform a broadcast write to both the primary and spacetime dimensioned versions of the memory element.

FIG. 13B is a flow chart illustrating how the speculative thread versionof the program accesses the memory element in accordance with anembodiment of the present invention. The speculative thread version ofthe program first de-references a pointer (such as space-timedimensioned version pointer 502 from FIG. 5) (step 1304). Thespeculative thread version of the program also sets marking bitsassociated with the memory element to indicate that speculative thread203 has accessed the memory element (step 1306). Finally, thespeculative thread version of the program accesses the memory elementthrough the de-referenced pointer. This access may take the form of aload operation or a store operation (step 1308).

FIG. 14 is a flow chart illustrating how the head thread version of theprogram and the speculative thread version of the program are created inaccordance with an embodiment of the present invention. The systemstarts by receiving a byte code version of a program (step 1402). Asmentioned previously, in one embodiment of the present invention thebyte code version of the program can include Java byte codes. Next, thesystem translates the byte code version of the program into a headthread version of the program that accesses the primary version of thememory element (step 1404). The system also translates the byte codeversion of the program into a speculative thread version of the program(step 1406). This speculative thread version of the program accesses thememory element indirectly through a pointer associated with the primaryversion of the memory element. As mentioned above, the pointer points tothe space-time dimensioned version of the memory element 510 if thespace-time dimensioned version of the memory element 510 exists.Otherwise, the pointer points to the primary version of the memoryelement 500.

The foregoing descriptions of embodiments of the invention have beenpresented for purposes of illustration and description only. They arenot intended to be exhaustive or to limit the invention to the formsdisclosed. Accordingly, many modifications and variations will beapparent to practitioners skilled in the art. Additionally, the abovedisclosure is not intended to limit the invention. The scope of theinvention is defined by the appended claims.

What is claimed is:
 1. A method for accessing versions of a memoryelement in a system that supports space and time dimensional execution,the system having a head thread that executes program instructions and aspeculative thread that executes program instructions in advance of thehead thread, the head thread accessing a primary version of the memoryelement and the speculative thread accessing a space-time dimensionedversion of the memory element, the method comprising: accessing theprimary version of the memory element during a reference to the memoryelement by the head thread; and during a reference to the memory elementby the speculative thread, accessing a pointer associated with theprimary version of the memory element, and accessing a version of thememory element through the pointer; wherein the pointer points to thespace-time dimensioned version of the memory element if the space-timedimensioned version of the memory element exists.
 2. The method of claim1, wherein the pointer points to the primary version of the memoryelement if the space-time dimensioned version of the memory element doesnot exist.
 3. The method of claim 1, wherein if the reference is a writeoperation by the speculative thread and the space-time dimensionedversion of the memory element does not exist, the system creates thespace-time dimensioned version of the memory element and sets thepointer to point to the space-time dimensioned version of the memoryelement.
 4. The method of claim 1, wherein if the reference is a readoperation by the speculative thread, the read operation is directed tothe space-time dimensioned version of the memory element if it exists,and otherwise is directed to the primary version of the memory element.5. The method of claim 1, wherein during a reference to the memoryelement by the speculative thread, the method further comprises updatingstatus information associated with the memory element to indicate thatthe reference to the memory element by the speculative thread tookplace.
 6. The method of claim 1, wherein the memory element is part ofan object defined within an object-oriented programming system.
 7. Themethod of claim 1, wherein the pointer points to a data structure thatpoints to the space-time dimensioned version of the memory element ifthe space-time dimensioned version of the memory element exists.
 8. Themethod of claim 1, wherein if the reference is a write operation by thehead thread, the method further comprises: checking status informationassociated with the memory element to determine if the space-timedimensioned version of the memory element has been written by thespeculative thread; and writing to the space-time dimensioned version ofthe memory element only if the speculative thread has not written to thespace-time dimensioned version of the memory element.
 9. The method ofclaim 1, wherein if the reference is a write operation by the headthread and the space-time dimensioned version of the memory elementexists, the method further comprises: performing the write operation tothe space-time dimensioned version of the memory element; checkingstatus information associated with the memory element to determine ifthe space-time dimensioned version of the memory element has beenwritten by the speculative thread; and if the space-time dimensionedversion of the memory element has been written by the speculativethread, causing the speculative thread to roll back so that thespeculative thread can perform the write operation again in order toundo the write operation to the space-time dimensioned version of thememory element by the head thread.
 10. A apparatus for facilitatingaccesses to versions of a memory element in a system that supports spaceand time dimensional execution, comprising: a thread execution mechanismsupporting a head thread that executes program instructions, and aspeculative thread that executes program instructions in advance of thehead thread; wherein the head thread accesses a primary version of thememory element and the speculative thread accesses a space-timedimensioned version of the memory element; a head thread memoryreference mechanism that accesses the primary version of the memoryelement during a reference to the memory element by the head thread; anda speculative thread memory reference mechanism that accesses a versionof the memory element through a pointer associated with the primaryversion of the memory element during a reference to the memory elementby the speculative thread; wherein the pointer points to the space-timedimensioned version of the memory element if the space-time dimensionedversion of the memory element exists.
 11. The apparatus of claim 10,wherein the pointer points to the primary version of the memory elementif the space-time dimensioned version of the memory element does notexist.
 12. The apparatus of claim 10, wherein if the reference is awrite operation by the speculative thread and the space-time dimensionedversion of the memory element does not exist, the speculative threadmemory reference mechanism is configured to, create the space-timedimensioned version of the memory element; and to set the pointer topoint to the space-time dimensioned version of the memory element. 13.The apparatus of claim 10, wherein if the reference is a read operationby the speculative thread, the speculative thread memory referencemechanism is configured to, direct the read operation to the space-timedimensioned version of the memory element if it exists, and otherwise todirect the read operation to the primary version of the memory element.14. The apparatus of claim 10, wherein the speculative thread memoryreference mechanism is configured to update status informationassociated with the memory element to indicate that the reference to thememory element by the speculative thread took place.
 15. The apparatusof claim 10, wherein the memory element is part of an object definedwithin an object-oriented programming system.
 16. The apparatus of claim10, wherein the pointer points to a data structure that points to thespace-time dimensioned version of the memory element if the space-timedimensioned version of the memory element exists.
 17. A computerreadable storage medium storing instructions that when executed by acomputer cause the computer to facilitate accesses to versions of amemory element in a system that supports space and time dimensionalexecution, the computer readable storage medium including: a head threadversion of a program for execution by a head thread that accesses aprimary version of the memory element; and a speculative thread versionof the program for execution by a speculative thread that accesses aversion of the memory element through a pointer associated with theprimary version of the memory element; wherein the pointer points to aspace-time dimensioned version of the memory element if the space-timedimensioned version of the memory element exists.
 18. The computerreadable storage medium of claim 17, wherein the pointer points to theprimary version of the memory element if the space-time dimensionedversion of the memory element does not exist.
 19. The computer readablestorage medium of claim 17, wherein the head thread version of theprogram and the speculative thread version of the program are translatedinto executable code from the same source code program.
 20. The computerreadable storage medium of claim 17, wherein the memory element is partof an object defined within an object-oriented programming system.
 21. Amethod for producing code to access versions of a memory element in asystem that supports space and time dimensional execution, the systemhaving a head thread that executes program instructions and aspeculative thread that executes program instructions in advance of thehead thread, the head thread accessing a primary version of the memoryelement and the speculative thread accessing a space-time dimensionedversion of the memory element, the method comprising: receiving a bytecode version of a program; translating the byte code version of theprogram into a head thread version of the program that accesses theprimary version of the memory element; and translating the byte codeversion of the program into a speculative thread version of the programthat accesses a version of the memory element through a pointerassociated with the primary version of the memory element; wherein thepointer points to the space-time dimensioned version of the memoryelement if the space-time dimensioned version of the memory elementexists.
 22. The method of claim 21, wherein the pointer points to theprimary version of the memory element if the space-time dimensionedversion of the memory element does not exist.
 23. The method of claim21, wherein the memory element is part of an object defined within anobject-oriented programming system.
 24. The method of claim 21, whereinthe byte code version of the program includes Java byte codes.